﻿@using XXS.Common.Paginate;
@model IPaginate<KTD.Web.Models.VD.MemberVD>

    <div class="x-body" id="box">
        <xblock style="height:50px;">

            <span class="x-left" style="line-height:40px">到访人数：@Model.SourceCount </span>
        </xblock>
        <table class="layui-table">
            <thead>
                <tr>
                    <th style="width:100px;">头像</th>
                    <th>微信名称</th>
                    <th>电话</th>
                    <th>到访时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.PageData)
                {
                    <tr>
                        <td><a title="预览" href="javascript:;" onclick="x_admin_show('预览','/Home/ImagePre?src=@item.avatarUrl')"><image class="imagePre" src="@item.avatarUrl"></image></a></td>
                        <td>@item.wechaname</td>
                        <td>@item.Mobile</td>
                        <td>@item.CreateDateTime</td>
                        <td class="td-manage">
                            <a title="删除" onclick="member_del(this,'@item.Id')" href="javascript:;">
                                <i class="layui-icon">&#xe640;</i>
                            </a>
                        </td>
                    </tr>
                }

            </tbody>
        </table>

        @{
            Html.RenderPartial("_paginate", Model);
        }





    </div>


@section scripts{
    <script>
        /*删除*/
        function member_del(obj, id) {
            layer.confirm('确认要删除吗？', function (index) {
                $.ajax({
                    url: '/Member/Delete',
                    type: 'post',
                    data: {
                        Id: id,
                    },
                    dataType: 'json',
                    success: function (res) {
                        if (res.success) {

                            $(obj).parents("tr").remove();
                            layer.msg('已删除!', { icon: 1, time: 1000 });
                        }
                        else {
                            layer.msg('添加失败，' + res.msg, { icon: 2, time: 5000 });
                        }

                    }
                });
            });
        }
    </script>
}

